<script setup>

let props = defineProps({
  control: Object,
  formProps: Object,
  enData: Object
})

function requiredChange(value) {
  props.control.rules[0].required = value;
}

function requiredMessageChange(value) {
  props.control.rules[0].message = value;
}

</script>

<template>
  <el-form label-width="90px">
    <el-form-item label="中文名称">
      <el-input v-model="control.props.label" placeholder="请输入中文名称"></el-input>
    </el-form-item>
    <el-form-item label="英文名称">
      <el-select v-if="props.enData?.options?.length" v-model="control.props.enName" placeholder="请选择英文名称"
                 style="width: 100%">
        <el-option
            v-for="(item, index) in props.enData.options"
            :key="index"
            :label="item[props.enData.label]"
            :value="item[props.enData.value]"
        />
      </el-select>
      <el-input v-else v-model="control.props.enName" placeholder="请输入英文名称"></el-input>
    </el-form-item>
    <el-form-item label="填写提示">
      <el-input v-model="control.props.placeholder" placeholder="请输入填写提示"></el-input>
    </el-form-item>
    <el-form-item label="时间格式">
      <el-select v-model="control.props.format" style="width: 100%;">
        <el-option value="HH:mm" label="时/分"></el-option>
        <el-option value="HH:mm:ss" label="时/分/秒"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="默认值">
      <el-time-select
          style="width: 100%;"
          v-model="control.props.defaultValue"
          :start="control.props.start"
          :step="control.props.step"
          :end="control.props.end"
          placeholder="请选择默认值"
      ></el-time-select>
    </el-form-item>
    <el-form-item label="时间范围">
      <el-select v-model="control.props.dateLimit" @change="typeChange" style="width: 100%;">
        <el-option value="no_limit" label="不限制"></el-option>
        <el-option value="limit_after" label="当前时间及以后"></el-option>
        <el-option value="limit_before" label="当前时间以前"></el-option>
      </el-select>
    </el-form-item>

    <!--        <el-form-item label="宽度">-->
    <!--            <el-slider-->
    <!--                class="w-11/12"-->
    <!--                :min="0"-->
    <!--                :max="formProps.cols"-->
    <!--                show-stops-->
    <!--                v-model="control.props.width"-->
    <!--            ></el-slider>-->
    <!--        </el-form-item>-->

    <!--        <el-form-item label="显示标题">-->
    <!--            <el-switch v-model="control.props.showLabel"></el-switch>-->
    <!--        </el-form-item>-->
    <!--        <el-form-item label="标题宽度">-->
    <!--            <el-input-number v-model="control.props.labelWidth" :min="0" />-->
    <!--        </el-form-item>-->

    <!--        <el-form-item label="开始时间">-->
    <!--            <el-time-select-->
    <!--                v-model="control.props.start"-->
    <!--                start="00:00"-->
    <!--                :step="control.props.step"-->
    <!--                end="23:59"-->
    <!--                placeholder="请选择开始时间"-->
    <!--            ></el-time-select>-->
    <!--        </el-form-item>-->
    <!--        <el-form-item label="结束时间">-->
    <!--            <el-time-select-->
    <!--                v-model="control.props.end"-->
    <!--                start="00:00"-->
    <!--                :step="control.props.step"-->
    <!--                end="23:59"-->
    <!--                placeholder="请选择结束时间"-->
    <!--            ></el-time-select>-->
    <!--        </el-form-item>-->
    <!--        <el-form-item label="间隔时间">-->
    <!--            <el-time-select-->
    <!--                v-model="control.props.step"-->
    <!--                start="00:00"-->
    <!--                step="00:05"-->
    <!--                end="02:00"-->
    <!--                placeholder="请选择间隔时间"-->
    <!--            ></el-time-select>-->
    <!--        </el-form-item>-->


    <el-form-item label="描述信息">
      <el-input type="textarea" rows="5" v-model="control.props.remark" placeholder="请输入描述信息"></el-input>
    </el-form-item>
    <el-form-item label="是否必填">
      <el-switch @change="requiredChange" v-model="control.props.required"></el-switch>
    </el-form-item>
    <el-form-item label="必填提示" v-if="control.props.required">
      <el-input @change="requiredMessageChange" v-model="control.props.requiredMessage"></el-input>
    </el-form-item>

    <!--        <el-form-item label="是否可手输">-->
    <!--            <el-switch v-model="control.props.editable"></el-switch>-->
    <!--        </el-form-item>-->
    <!--        <el-form-item label="是否可清空">-->
    <!--            <el-switch v-model="control.props.clearable"></el-switch>-->
    <!--        </el-form-item>-->
    <!--        <el-form-item label="是否禁用">-->
    <!--            <el-switch v-model="control.props.disabled"></el-switch>-->
    <!--        </el-form-item>-->
  </el-form>
</template>
